package apIExercise.exception;

import java.io.FileOutputStream;
import java.io.IOException;

public class TcyCAtchDemo {
    public static void main(String[] args) {
        /*
        System.out.println("程序开始");
        try (
                FileOutputStream fos = new FileOutputStream("dat/add")
        ) {
            fos.write(5);
        } catch (IOException e) {
            //e.printStackTrace();
            System.out.println("好好学习天天升级");
        } finally {
            //e.printStackTrace();
            System.out.println("写入完成");
        }
        System.out.println("程序结束");

         */
        System.out.println("程序开始");
        FileOutputStream fos=null;
        try {
            fos=new FileOutputStream("af/as/aq");
            fos.write(5);
        }catch (IOException e){
            System.out.println("出错并解决");
        }finally {
            try {
                fos.close();
            } catch (Exception e) {
                //e.printStackTrace();
                System.out.println("关流");
            }
        }
        System.out.println("程序结束");
    }
}
